<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>商品添加页面</title>
    <link rel="stylesheet" type="text/css" media="screen" th:href="@{/css/admin.css}"   href="../static/css/admin.css" >
    <script type="text/css">
        .frm{
            width: 600px;
            margin-top: 30px;

        }
    </script>
    <script type="text/javascript">
        //文件框选择图片时图片自动切换
        function showImg() {
            //文件访问对象
            var f =new FileReader();
            f.onload=function (ev) {
                img.src=ev.target.result;
            }
            f.readAsDataURL(file.files[0]);

        }
    </script>
</head>
<body>
<div id="frm">
    <div id="title">
        商品分类添加
    </div>
<form id="form" action="/goods/goods_add" method="post" enctype="multipart/form-data">
    <table id="table">
        <tr>
            <td >商品名称</td>
            <td >
                <input type="text" name="goodsname" required="required">
            </td>
        </tr>
        <tr>
            <td >商品价格</td>
            <td >
                <input type="text" name="price" required="required">
            </td>
        </tr>
        <tr>
            <td >商品地址</td>
            <td >
                <input type="text" name="address" required="required">
            </td>
        </tr>
        <tr>
            <td >商品日期</td>
            <td >
                <input type="date" name="produceDate" required="required">
            </td>
        </tr>
        <tr>
            <td >商品图片</td>
            <td >
                <img src="/img/57829afaa7810f36dc21390fe4b8b53c_200782210839649_2.jpg" width="80" height="100" id="img"/>
                <br/>
                <input type="file" name="file" id="file" onchange="showImg()"/>
            </td>
        </tr>
        <tr>
            <td>商品分类</td>
            <td >
               <select name="category.id">
                   <option value="">请选择</option>
                   <option  th:each="c:${categoryList}"
                            th:value="${c.getId()}"
                            th:text="${c.categoryname}">
                   </option>
               </select>
            </td>
        </tr>
        <td ><input type="submit" value="添加"></td>
        <td ><input type="reset" value="重置"></td>
        </tr>
    </table>
</form>
</div>
</body>
</html>